﻿using System.ServiceProcess;
using System.Threading;


namespace YEA.Monitor.LogService
{
    public partial class LogManagerService : ServiceBase
    {
        protected readonly ServiceStateController c;
        protected readonly Thread serviceThread ;
        public LogManagerService()
        {
            c = new ServiceStateController();
            InitializeComponent();
            serviceThread = new Thread(c.Start);
        }

        protected override void OnStart(string[] args)
        {
            if (serviceThread.ThreadState == ThreadState.Running)
                c.Start();
            else
                serviceThread.Start();
        }

        protected override void OnStop()
        {
            c.Stop();
        }
        protected override void OnPause()
        {
            c.Pause();
        }
        protected override void OnContinue()
        {
            c.Continue();
        }
    }
}
